package com.jeemicro.weixin.modules.timer_quartz.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.pentaho.di.core.exception.KettleException;
import org.pentaho.di.repository.kdr.KettleDatabaseRepository;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

public class KettleJob implements Job  {
	@Override  
    public void execute(JobExecutionContext arg0) throws JobExecutionException {  
		DbRepParams param = new DbRepParams();
		//资源库连接方式
		param.setType("MySQL");  //类型
		param.setHost("localhost"); //主机名称
		param.setName("jeemicro");//数据库名称
		param.setPort("3306");		//端口号
		param.setDb("jeemicro");
		param.setUser("root"); //数据库用户名
		param.setPass("514224717");
		param.setUsername("admin");
		param.setPassword("514224717");    //密码
		
		try {
			KettleDatabaseRepository obj = KettleUtils.initDatabaseRepository(param);
			KettleUtils.executeTrans("", obj);
			System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())+ "★★★★★★★★★★★");    
		} catch (KettleException e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		}
    }  
}
